package com.cheneyjoo.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 考题
 */
public class Question implements Serializable {
    private static final long serialVersionUID = 5752526536488483522L;
    private int id;
    private String name;
    private String rightAnswer;
    private int score;
    private List<Answer> answers=new ArrayList<>();
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }

    public Question() {
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRightAnswer() {
        return rightAnswer;
    }

    public void setRightAnswer(String rightAnswer) {
        this.rightAnswer = rightAnswer;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public List<Answer> getAnswers() {
        return answers;
    }

    public void setAnswers(List<Answer> answers) {
        this.answers = answers;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Question question = (Question) o;
        return id == question.id &&
                score == question.score &&
                name.equals(question.name) &&
                rightAnswer.equals(question.rightAnswer) &&
                answers.equals(question.answers);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, rightAnswer, score, answers);
    }

    @Override
    public String toString() {
        return "Question{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", rightAnswer='" + rightAnswer + '\'' +
                ", score=" + score +
                ", answers=" + answers +
                '}';
    }
}
